<template>
  <div class="home">
    <div class="homeLeft">
      <HomeLeft :childId.sync="id"></HomeLeft>
    </div>
    <div class="homeRight">
      <HomeRight :parentData="list"></HomeRight>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src
import HomeLeft from '@/components/HomeLeft.vue'
import HomeRight from '@/components/HomeRight.vue'

export default {
  name: 'Home',
  components: {
    HomeLeft,
    HomeRight
  },
  data () {
    return {
      id:1,
      list:[],
    }
  },
  watch: {
    id:{
      handler(val){
        if(val==1){
          this.list=[
            { id: 1, title: '行业资讯1', time: '2021-05-18' },
            { id: 2, title: '行业资讯2', time: '2021-05-18' },
          ];
        }else if(val==2){
          this.list=[
            { id: 1, title: '公司新闻1', time: '2021-04-18' },
            { id: 2, title: '公司新闻2', time: '2021-04-18' },
          ];
        }
      },
      immediate:true,
    }
  }
}
</script>

<style scoped lang="scss">
.home{
  display: flex;
  .homeLeft{
    width: 30%;
    background: #f0f0f0;
  }
  .homeRight{
    width:70%;
  }
}
</style>